package de.mhus.lib.mandala.functions;

import de.mhus.lib.mandala.Response;
import de.mhus.lib.mandala.UiUtil;

public class EncapsulatedFunctionCall extends FunctionCall {

	private Object[] list;
	private String functionAttributes;

	public EncapsulatedFunctionCall(String functionAttributes, Object ... list) {
		this.list = list;
		this.functionAttributes = functionAttributes;
	}

	@Override
	protected void doRender(Response out) {
		out.print("function(");
		if (functionAttributes != null) out.print(functionAttributes);
		out.print(") {");
		UiUtil.renderAsFunctions(list, getParent(), out);
		out.print("}");
	}
}
